clc
clear
close all

Ts=0.1;
Tref=10;
Tmax=30;

refPomoc=zeros(1,Tref/Ts);

refPomoc(1,(Tref/0.4):(3*Tref/0.4))=25;

ref=refPomoc;


param.ref=ref;

[y,t,out]=simulace(@pitch_model,@mpc_pitch_ref,Tmax/Ts,Ts,zeros(3,1),0,param);

ref=out.ref;
u=out.u;

figure
plot(t,y(1,:),t,ref(1,:),'r',t,u(:),'k');
grid on;
legend('y1','ref1','u');
ylabel('y [-]');
xlabel('t [s]');

dif=y-ref;
max(dif(200:end))
